#!/usr/bin/env python
#-*- coding: utf-8 -*-

import my_latex as ml

ml.print_formula(r"""
\begin{equation}
  \vect{X} = \transp{\begin{pmatrix}x&z&v_a&\gamma_a&\alpha&q\end{pmatrix}}, \quad
  \vect{U} = \transp{\begin{pmatrix}d_e&d_{th}\end{pmatrix}}\nonumber
\end{equation}
""", "../images/wiki/longitudinal_fixed_wing_state_space_1.png")

ml.print_formula(r"""
\begin{equation}
  \begin{pmatrix}\dot{x}\\\dot{z}\\\dot{v}_a\\\dot{\gamma}_a\\\dot{\alpha}\\\dot{q}\end{pmatrix}  = 
  \begin{pmatrix}
    v_a.\cos{\gamma_a}+W_x^R\\
    -v_a.\sin{\gamma_a}+W_z^R\\
    \frac{T}{m}.\cos{\alpha} -\frac{D}{m} -g.\sin{\gamma_a} - \dot{W}_x^R.\cos{\gamma_a} + \dot{W}_z^R.\sin{\gamma_a}\\
    \frac{1}{v_a}\left( \frac{T}{m}.\sin{\alpha} +\frac{L}{m} -g.\cos{\gamma_a} + \dot{W}_x^R.\sin{\gamma_a} + \dot{W}_z^R.\cos{\gamma_a}\right)\\
    q - \dot{\gamma}_a\\
    \frac{1}{I}.M^B
  \end{pmatrix}\nonumber
\end{equation}
""", "../images/wiki/longitudinal_fixed_wing_state_space_2.png")

ml.print_formula(r"""
\begin{equation}
  T = T_\text{max}.(\frac{\rho}{\rho_i})^{n\rho}.(\frac{v_a}{v_{ai}})^{nv}.d_{th}\nonumber
\end{equation}
""", "../images/wiki/longitudinal_fixed_wing_def_thrust.png")

ml.print_formula(r"""
\begin{equation}
  L = \frac{1}{2}.\rho.v_a^2.S_\text{ref}.C_L\nonumber
\end{equation}
""", "../images/wiki/longitudinal_fixed_wing_def_lift.png")

ml.print_formula(r"""
\begin{equation}
D = \frac{1}{2}.\rho.v_a^2.S_\text{ref}.\left(C_{D0} + C_{Dk1}.C_L + C_{Dk2}.C_L^2\right)\nonumber
\end{equation}
""", "../images/wiki/longitudinal_fixed_wing_def_drag.png")


ml.print_formula(r"""
\begin{equation}
M^B = \frac{1}{2}.\rho.v_a^2.S_\text{ref}.c_\text{ref} \left(C_{m0} + C_{m\alpha}.\alpha + C_{mde}.d_e\right)\nonumber
\end{equation}
""", "../images/wiki/longitudinal_fixed_wing_def_moment.png")
